各位先進好,最近想寫一個利用Gmail或Yahoo的mail server發信的程式,不過遇到了瓶頸,不知各位先進是否有相關經驗,或目前正在使用此功能的先進可以幫忙一下,感激不盡!
以下是我的簡單設定內容:
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.Credentials = new System.Net.NetworkCredential("account", "password");
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
smtp.Send(mms);
整個程式mail server的部份我有改用公司的mail server設定,是確定可以發送出去的沒問題,只是改用gmail或yahoo的mail server就會遇到問題,目前已遇到兩三種error,找了google大師都沒有找到解答,故上來求救一下!
Error log 1:(使用gmail)
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
下列方法已做,將gmail的[允許安全性較低的應用程式] 設定處於啟用狀態=>啓用
solution 1 for case 2: go to security settings at the followig link https://www.google.com/settings/security/lesssecureapps and enable less secure apps . So that you will be able to login from all apps.
Error log 2:(使用yahoo)
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required
已經不知道還有什麼方法可以嚐試解決了,先謝謝各位幫忙了~感激!
您好!
這裡是文章區
如需提問請轉發問區XD
應該就可以寄送mail了